home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Format 1994 October
/
Macformat17.cdr
/
Shareware City
/
Developers
/
MungeImage Source
/
DInstaller.p
< prev
next >
Wrap
Text File
|
1994-06-18
|
2KB
|
82 lines
program DInstaller;
uses
EPPC, AppleEvents, RequiredEventSupport, MyDriver;
const
Driver_Name = '.MungeImage';
var
drvr_ref: integer;
quitNow: boolean;
have_opened: boolean;
function DoODoc (fss: FSSpec): OSErr;
var
err: OSErr;
pb: ParamBlockRec;
begin
have_opened := true;
with pb do begin
ioCRefNum := drvr_ref;
csCode := 666;
ioMisc := @fss;
end; (* with *)
err := PBControlSync(@pb);
if err <> noErr then begin
SysBeep(10);
end; (* if *)
quitNow := true;
DoODoc := err;
end; (* DoODoc *)
function DoOApp: OSErr;
begin
quitNow := true;
DoOApp := noErr;
end;
function DoQuit: OSErr;
begin
quitNow := true;
DoQuit := noErr;
end; (* DoQuit *)
var
junkbool: boolean;
event: EventRecord;
err: OSErr;
junk: OSErr;
junk_vref: integer;
response: longint;
begin
if (Gestalt(gestaltSystemVersion, response) <> noErr) | (response < $700) then begin
ExitToShell;
end; (* if *)
err := InitAppleEvents(@DoOApp, @DoODoc, nil, @DoQuit);
if err = noErr then begin
drvr_ref := GetDriverRefNum(Driver_Name);
if drvr_ref <> 0 then begin
err := noErr;
end
else begin
err := InstallRAMDriver(Driver_Name, drvr_ref, true);
end;
if err = noErr then begin
quitNow := false;
while not quitNow do begin
junkbool := WaitNextEvent(everyEvent, event, maxlongint, nil);
case event.what of
keyDown:
quitNow := true;
kHighLevelEvent:
junk := AEProcessAppleEvent(event);
otherwise
;
end; (* case *)
end; (* while *)
end; (* if *)
end; (* if *)
if err <> noErr then begin
SysBeep(10);
end;
end. (* DInstaller *)